import {Service} from "adajs";
import User from "./../../../lib/user";

class NewsService extends Service {
    defaultData() {
        return {
            isLoad: false,
            newsInfo: {
                "ltzid": "8fb74620-afbd-4749-975b-3c9f723eb958",
                "zflx": 0,
                "zfld": "宝贝1",
                "ptry": "出参1",
                "wwp": "方法1",
                "zfsj": "2018-12-12 00:00:00",
                "fywt": "爱爱爱1",
                "zfdd": "11",
                "qtry": "等待1",
                "crtUser": "admin",
                "crtTime": "2018-12-19 11:29:32",
                "crtIp": "39.155.166.62",
                "updUser": "admin",
                "updTime": "2018-12-19 11:43:19",
                "updIp": "39.155.166.62",
                "ltzInfo": {
                    "xm": "测试人员",
                    "xmOld": "",
                    "sex": "女",
                    "zzmm": "24b2e20a-200f-4e9c-9ded-a06a3164deb7",
                    "xl": "411029e1-7e16-480a-ad6c-37a1fe52b818",
                    "mz": "39353a6f-8ada-4b04-af64-cb68323bfc23",
                    "rdsj": "2017-06-21",
                    "rzsj": "1956-10-01",
                    "post": "呼伦贝尔海拉尔创业局",
                    "retiredType": "离休",
                    "retiredDate": "2015-12-13",
                    "retiredPost": "正部级",
                    "treatment": "4fc29253-2dce-4ea7-a6fc-8fb856fe1d99",
                    "treatmentDate": "2018-12-13",
                    "raiseTreatment": "",
                    "jg": "湖南省娄底市",
                    "szdzb": "一支部",
                    "experience": "测试添加工作经历",
                    "birthday": "1966-06-06",
                    "birth": "1928-10-23",
                    "birthdayBz": "fd43b893-4fc9-4c71-b56b-eefb8af13835",
                    "age": 52,
                    "id": "8fb74620-afbd-4749-975b-3c9f723eb958"
                },
                "hosInfo": {
                    "ltzid": "8fb74620-afbd-4749-975b-3c9f723eb958",
                    "yiyuan": "医院",
                    "ksbc": "科室病床",
                    "bq": "住院病情",
                    "zljg": "为看望原因",
                    "phr": "陪护人",
                    "phrdh": "13211111111",
                    "rysj": "2018-12-03 00:00:00",
                    "cysj": "2018-12-11 00:00:00",
                    "sfcy": "6263bb00-33dc-49e1-842f-b9b694b4694c",
                    "wkwyy": "治疗结果",
                    "sfkw": "73f6c2cd-8f5b-4dc7-ba6f-af7125a49ef3",
                    "crtUser": "admin",
                    "crtTime": "2018-12-19 15:46:12",
                    "crtIp": "192.168.104.64",
                    "updUser": "admin",
                    "updTime": "2018-12-19 16:01:46",
                    "updIp": "39.155.166.62",
                    "id": "b032b821-f040-47ab-bee0-8a349c02b2f3"
                },
                "id": "d99e133c-7f18-4b59-8942-09833dfc9a7d"
            },
            id: "",
            error: false,
            msg: ''
        };
    }

    onupdate(current, id) {
        if (id) {
            return this.context.request.post("/api/lgb/app/lgb/consolation/get", {id}).then(({code, msg, data}) => {
                current.id = id;
                current.isLoad = true;
                if (code === '1') {
                    current.newsInfo = data;
                } else {
                    current.error = true;
                    current.msg = msg;
                }
            });
        }
    }
}

export default NewsService;